//initJbxx();
initGlxx();
function initGlxx(){
	var enterpriseid=  getQueryString("enterpriseid");
	$.ajax({  
		url:'../many/queryGrMsgByPersonalId',
		type:'post',
		data:{
		"id":enterpriseid,
		"indexType":'0'
		},
		dataType:'json',
		success:function(data){ 
			var count = data.count;
			$("#zrrBodyId").empty();
			for (var i = 1; i <= count; i++) {
				var groupName ="groupName"+i ;
				var groupNameVal = getValBykey(groupName,data);
				var cnamels = "cnamels"+i;
				var cnamelsVal = getValBykey(cnamels,data);
				var listval = "listval"+i;
				var listvalVal = getValBykey(listval,data);
				var sjIdStr="";
				for(var j = 0; j < listvalVal.length; j++) {	
					sjIdStr+='<tr>';
					var entityls = listvalVal[j];
					$.each(entityls, function(index, str){
						sjIdStr+='<td width="15%" >'+str+'</td>';
					})
					sjIdStr+='</tr>';
				}
				var cnameStr='';
				$.each(cnamelsVal, function(index,cname ){
					cnameStr+='<td>'+cname+'</td>';
				})
				var resultStr='<table class="tablegalcredit" cellpadding="0" cellspacing="0">'
				     +'<caption class="textleft">&nbsp;&nbsp;&nbsp;&nbsp;'+groupNameVal+'</caption>'
				     +'<thead><tr>'+cnameStr+'</tr>'
				     +'</thead><tbody>'+sjIdStr+'</tbody></table>';
				$("#zrrBodyId").append(resultStr);
			}
			
		}
		
	})
}
function initJbxx(){
	var enterpriseId=  getQueryString("enterpriseid");
	$.ajax({  
		url:'../many/queryQyMsgByEnterpriseId',
		type:'post',
		data:{
		"enterpriseid":enterpriseId
		},
		dataType:'json',
		success:function(data){ 
			var list= data.rows;
			if(list.length==0){
				alert("未查询到相关信息");
				return;
			}
			var entity = list[0];
			var clrqtime='';
			var clrqDate = entity.v_QY_INDEX_2067;//成立日期H
			if(clrqDate!=null&&clrqDate!=''){
				var clrq = new Date(clrqDate);
				clrqtime= clrq.format("yyyy-MM-dd");
			}
		
			$("#qymcId").html(entity.v_QY_INDEX_2060==null?"":entity.v_QY_INDEX_2060);
			$("#tyshxydmId").html(entity.v_QY_INDEX_2061==null?"":entity.v_QY_INDEX_2061);
			$("#jyfwId").html(entity.v_QY_INDEX_2071==null?"":entity.v_QY_INDEX_2071);
			$("#lbId").html(entity.v_QY_INDEX_2062==null?"":entity.v_QY_INDEX_2062);
			$("#qyjglxId").html(entity.v_QY_INDEX_2063==null?"":entity.v_QY_INDEX_2063);
			$("#zczbId").html(entity.v_QY_INDEX_2064==null?"":entity.v_QY_INDEX_2064);
			$("#zczbbzId").html(entity.v_QY_INDEX_2065==null?"":entity.v_QY_INDEX_2065);
			$("#hymlId").html(entity.v_QY_INDEX_2066==null?"":entity.v_QY_INDEX_2066);
			$("#clrqId").html(clrqtime);
			$("#djjgId").html(entity.v_QY_INDEX_2068==null?"":entity.v_QY_INDEX_2068);
			$("#ztId").html(entity.v_QY_INDEX_2070==null?"":entity.v_QY_INDEX_2070);
			$("#dzId").html(entity.v_QY_INDEX_2069==null?"":entity.v_QY_INDEX_2069);
		}
	})
}



//获取参数
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
function getValBykey(key,data){
	for(var item in data){
		if(item==key){
			return data[item];
		}
	}
}
//时间格式
Date.prototype.format = function(format){
	var o = {
	"M+" : this.getMonth()+1, //month
	"d+" : this.getDate(), //day
	"h+" : this.getHours(), //hour
	"m+" : this.getMinutes(), //minute
	"s+" : this.getSeconds(), //second
	"q+" : Math.floor((this.getMonth()+3)/3), //quarter
	"S" : this.getMilliseconds() //millisecond
	}

	if(/(y+)/.test(format)) {
	format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
	}

	for(var k in o) {
	if(new RegExp("("+ k +")").test(format)) {
	format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
	}
	}
	return format;
	}